import Vue from 'vue'
import VueRouter from 'vue-router'

const Dictionaries = r => require.ensure([], () => r(require('@/views/Dictionaries'))) // 词典
const Interpret = r => require.ensure([], () => r(require('@/views/Interpret'))) // 翻译
const WordBook = r => require.ensure([], () => r(require('@/views/WordBook'))) // 单词本
const DocInterpret = r => require.ensure([], () => r(require('@/views/DocInterpret'))) // 文档翻译
const Login = r => require.ensure([], () => r(require('@/views/Login'))) // 登录

Vue.use(VueRouter)

export const constantRouterMap = [
  {
    path: '/',
    component: Dictionaries
  },
  {
    path: '/interpret',
    component: Interpret
  },
  {
    path: '/wordBook',
    component: WordBook
  },
  {
    path: '/docInterpret',
    component: DocInterpret
  },
  {
    path: '/login',
    component: Login
  }
]

export default new VueRouter({
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})
